package com.gdcp.controller.portal;

import com.gdcp.beans.Banner;
import com.gdcp.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 杨华京
 * @version 1.0
 * @description
 * @since 1.8
 */
@Controller
@RequestMapping("/banner/")
public class BannerController {

    @Autowired
    private BannerService bannerService;

    @RequestMapping(value = "/getBanners",method = RequestMethod.GET)
    public String getBanners(Model model){
        List<Banner> banner = bannerService.queryByStatus();
        model.addAttribute("banners",banner);
        return "frontend/common/banners";
    }
}
